<template>
  <div class="emotion-list-cover">
    <div class="emotion-list">
      <div
        v-for="index in 71"
        :key="index"
        class="pic-item"
        @click="onClickEmotion(index)"
      >
        <img
          class="img-style"
          :src="`/emoji/png/${emojiName(index)}`"
        >
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
  methods: {
    emojiName (index: number) {
      return `huikaoba_0${index < 10 ? '0' : ''}${index}.png`
    },
    // 选中表情
    onClickEmotion (index: number) {
      // this.$emit('appendInputValue', `#[${this.emojiName(index)}]#`)
      this.$emit('appendInputValue', this.emojiName(index))
    },
  },
})
</script>

<style lang="scss" scoped>
.emotion-list-cover {
  width: 100%;
  height: 300px;
  overflow-y: auto;
  background: #fff;
}
.emotion-list {
  margin: 0 auto;
  width: 720px;
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
}
.pic-item {
  margin: 10px 20px;
}
.img-style {
  width: 50px;
}
</style>
